//
// Created by ssii on 2020/1/8.
//
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include <event2/event.h>
#include <time.h>

void event_callback(evutil_socket_t t, short fd, void *args) {
    printf("callback:%d\n",time(NULL));

}
/**
 *
 */
int main() {
    struct event_base *base = NULL;
    base = event_base_new();
    struct event *pEvent = event_new(base, -1, EV_PERSIST, event_callback, base);
    struct timeval timeout;
    timeout.tv_sec = 3;
    timeout.tv_usec = 0;

    event_add(pEvent, &timeout);
    event_base_dispatch(base);
    event_free(pEvent);
    event_base_free(base);
}